package com.ostrich.demomvvm.utils

import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CircleCrop
import com.ostrich.demomvvm.R

/**
 * @Author : yaotianxue
 * @Time : On 2023/10/19 09:34
 * @Description : ImageAdapter
 */
class ImageAdapter {

    companion object{
        @JvmStatic
        @BindingAdapter("android:setImage")
        fun setImage(imageView:ImageView,url:String){
            Glide.with(imageView)
                .load(url)
                .placeholder(R.drawable.ic_launcher_background)
                .transform(CircleCrop())
                .into(imageView)
        }
    }

}